package com.amigo.online.consumer.user.controller;



import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.amigo.online.common.base.controller.BaseConsumerController;
import com.amigo.online.common.core.response.Response;
import com.amigo.online.consumer.user.service.FollowService;

/**
 * 用户相关
 * @author amigo
 *
 */
@RestController
@RequestMapping(value = "/follow", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class FollowController extends BaseConsumerController {
	
	
	@Autowired
	FollowService followService;
	
	//关注用户
	@GetMapping(value = "/add/{userId}")
	public ResponseEntity<Response> concern(@PathVariable Long userId) {
	     return followService.concern(userId);
	}
	
	
	//取消关注用户
	@DeleteMapping(value = "/cancel/{userId}")
	public ResponseEntity<Response> cancel(@PathVariable Long userId) {
	     return followService.cancel(userId);
	}
	
	
	//获取用户粉丝列表
	@GetMapping(value = "/my/fans/{page}/{size}")
	public ResponseEntity<Response> getMyFans(@PathVariable Integer page,@PathVariable Integer size) {
	     return followService.getMyFans(page,size);
	}
	
	//根据id获取用户粉丝列表
	@GetMapping(value = "/fans/{id}/{page}/{size}")
	public ResponseEntity<Response> getFansById(@PathVariable Long id,@PathVariable Integer page,@PathVariable Integer size) {
	     return followService.getFansById(id,page,size);
	}
	
	
	//获取我关注的人的列表
	@GetMapping(value = "/my/concern/{page}/{size}")
	public ResponseEntity<Response> getMyConcern(@PathVariable Integer page,@PathVariable Integer size) {
	     return followService.getMyConcern(page,size);
	}

	//获取我关注的人的列表
	@GetMapping(value = "/concern/{id}/{page}/{size}")
	public ResponseEntity<Response> getConcernById(@PathVariable Long id,@PathVariable Integer page,@PathVariable Integer size) {
	     return followService.getConcernById(id,page,size);
	}
	
	//获取我关注的视频
	@GetMapping(value = "/my/concern/video/{page}/{size}")
	public ResponseEntity<Response> getMyConcernVideos(@PathVariable Integer page,@PathVariable Integer size) {
	     return followService.getMyConcernVideos(page,size);
	}
	
	@GetMapping(value = "/my/getFriends")
	public ResponseEntity<Response> getFriends() {
		return followService.getFriends();
	}
}
